package com.google.code.task.example;

import static com.google.code.task.Style.*;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.google.code.task.example.resources.LoggingCurrentTimeTask;
import com.google.code.task.example.resources.TaskEventHandler;

public class AsyncerDecoratorExample {
  static final int RETRY_COUNT = 3;
  static final Log LOG = LogFactory.getLog(AsyncerDecoratorExample.class);

  public static void main(String[] args) throws Exception {
    startAsyncerTaskProcessor();
    
    startTask();
    new LoggingCurrentTimeTask()
      .asynchronously().event(new TaskEventHandler())
      .execute();
    endTask();
    
    startTask();
    asyncer(
        task(new LoggingCurrentTimeTask()),
        event(new TaskEventHandler())
    ).execute();
    endTask();

    endAsyncerTaskProcessor();
  }
}
